const state = {
  order: null
}

const mutations = {
  SAVE_ORDER: (state, data) => {
    state.order = data
  }
}

const actions = {
  async saveOredr({ commit }, data) {
    commit('SAVE_ORDER', data)
    console.log('vuex/saveOrder-log: 订单信息储存成功', data)
  },
  async clearOrder({ commit }) {
    commit('SAVE_ORDER', null)
    console.log('vuex/clearOrder-log: 订单信息清除成功')
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}
